package com.jtjrenren.android.taxi.driver.core.other;

import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.route.BaiduMapRoutePlan;
import com.baidu.mapapi.utils.route.RouteParaOption;
import com.jtjrenren.android.taxi.driver.R;
import com.jtjrenren.android.taxi.driver.base.BaseActivity;
import com.library.utils.LogUtil;

import butterknife.OnClick;

/**
 * Created by wdl on 2016/10/11.
 */

public class DemoActivity extends BaseActivity {
    @Override
    public int getLayoutID() {
        return R.layout.aty_demo;
    }

    @Override
    public void init() {


    }

    @OnClick(R.id.demo_click)
    public void clickDemo() {
        startDH();
    }

    private void startDH() {
        // 天安门坐标
        double mLat1 = 39.915291;
        double mLon1 = 116.403857;
        // 百度大厦坐标
        double mLat2 = 40.056858;
        double mLon2 = 116.308194;


        LatLng ptStart = new LatLng(34.264642646862, 108.95108518068);
        LatLng ptEnd = new LatLng(mLat2, mLon2);

        // 构建 route搜索参数
        RouteParaOption para = new RouteParaOption()
                .startPoint(ptStart)
//            .startName("天安门")
//            .endPoint(ptEnd);
                .endName("大雁塔")
                .cityName("西安");

//        RouteParaOption para = new RouteParaOption()
//                .startName("天安门").endName("百度大厦");

//        RouteParaOption para = new RouteParaOption()
//        .startPoint(pt_start).endPoint(pt_end);

        try {
            BaiduMapRoutePlan.openBaiduMapDrivingRoute(para, this);
        } catch (Exception e) {
            e.printStackTrace();
            displayShort("您尚未安装百度地图app或app版本过低");
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        LogUtil.log("debug","界面不可见");
    }
}
